home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / shell / csh548src.lha / globals.c < prev    next >
C/C++ Source or Header  |  1995-06-04  |  6KB  |  166 lines

  1. /*
  2.  * GLOBALS.C
  3.  *
  4.  * (c)1986 Matthew Dillon     9 October 1986
  5.  *
  6.  *    Most global variables.
  7.  *
  8.  * Version 2.07M by Steve Drew 10-Sep-87
  9.  * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90
  10.  * Version 5.00L by Urban Mueller 17-Feb-91
  11.  * Version 5.20L by Andreas M. Kirchwitz (Fri, 13 Mar 1992)
  12.  *
  13.  */
  14.  
  15. #include "shell.h"
  16.  
  17. char v_titlebar    []="_titlebar";    /* Window title                */
  18. char v_prompt    []="_prompt";    /* your prompt (ascii command)        */
  19. char v_hist    []="_history";    /* set history depth (value)        */
  20. char v_histnum    []="_histnum";    /* set history numbering var        */
  21. char v_debug    []="_debug";    /* set debug mode            */
  22. char v_verbose    []="_verbose";    /* set verbose for source files        */
  23. char v_stat    []="_maxerr";    /* worst return value to date        */
  24. char v_lasterr    []="_lasterr";    /* return value from last comm.        */
  25. char v_cwd    []="_cwd";    /* current directory            */
  26. char v_except    []="_except";    /* "nnn;command"            */
  27. char v_every    []="_every";    /* executed before prompt        */
  28. char v_passed    []="_passed";    /* passed arguments to source file    */
  29. char v_path    []="_path";    /* search path for external commands    */
  30. char v_gotofwd    []="_gtf";    /* set name for fwd goto name        */
  31. char v_linenum    []="_linenum";    /* name for forline line #        */
  32. char v_lcd    []="_lcd";    /* last current directory        */
  33. char v_rxpath    []="_rxpath";    /* path for .rexx commands        */
  34. char v_hilite    []="_hilite";    /* hilighting escape sequence        */
  35. char v_scroll    []="_scroll";    /* scroll jump in fast mode        */
  36. char v_minrows    []="_minrows";    /* minimum # of rows for fast scroll    */
  37. char v_result    []="_result";    /* result from rxsend            */
  38. char v_qcd    []="_qcd";    /* file name for csh-qcd        */
  39. char v_noreq    []="_noreq";    /* turn off system requesters        */
  40. char v_value    []="_value";    /* return value of a function        */
  41. char v_nobreak    []="_nobreak";    /* disabling of ^C            */
  42. char v_bground    []="_bground";    /* started in background        */
  43. char v_pipe    []="_pipe";    /* path for pipes            */
  44. char v_datefmt    []="_datefmt";    /* format of dates            */
  45. char v_ioerr    []="_ioerr";    /* last secondary result        */
  46. char v_abbrev    []="_abbrev";    /* disable command abbreviations    */
  47. char v_rback    []="_rback";    /* command to be used for '&'        */
  48. char v_insert    []="_insert";    /* insert mode                */
  49. char v_failat    []="_failat";    /* batch file fail level        */
  50. char v_clipri    []="_clipri";    /* command line priority        */
  51. char v_dirformat[]="_dirformat";/* format string for "dir" command    */
  52. char v_nomatch    []="_nomatch";    /* abort if pattern doesn't match    */
  53. char v_prghash    []="_prghash";    /* file for program hash table        */
  54. char v_cquote    []="_cquote";    /* commodore-shell compatible quotes    */
  55. char v_mappath    []="_mappath";    /* map unix pathes /usr/... to usr:...    */
  56. char v_timeout    []="_timeout";    /* timeout for window bounds report    */
  57. char v_promptdep[]="_promptdep";/* maximum number of dirs in %p/prompt    */
  58. char v_complete    []="_complete";    /* files that match on file completion    */
  59.  
  60. HIST *H_head, *H_tail;    /* HISTORY lists */
  61.  
  62. PERROR Perror[]= {    /* error code->string */
  63.     103,    "not enough memory available",
  64.     105,    "process table full",
  65.     114,    "bad template",
  66.     115,    "bad number",
  67.     116,    "required argument missing",
  68.     117,    "value after keyword missing",
  69.     118,    "wrong number of arguments",
  70.     119,    "unmatched quotes",
  71.     120,    "argument line invalid or too long",
  72.     121,    "file is not executable",
  73.     122,    "invalid resident library",
  74. /* ! */    201,    "No default directory",
  75.     202,    "object is in use",
  76.     203,    "object already exists",
  77.     204,    "directory not found",
  78.     205,    "object not found",
  79.     206,    "invalid window description",
  80.     207,    "object too large",
  81.     209,    "packet request type unknown",
  82.     210,    "object name invalid",
  83.     211,    "invalid object lock",
  84.     212,    "object is not of required type",
  85.     213,    "disk not validated",
  86.     214,    "disk is write-protected",
  87.     215,    "rename across devices attempted",
  88.     216,    "directory not empty",
  89.     217,    "too many levels",
  90.     218,    "device (or volume) is not mounted",
  91.     219,    "seek failure",
  92.     220,    "comment is too long",
  93.     221,    "disk is full",
  94.     222,    "object is protected from deletion",
  95.     223,    "file is write protected",
  96.     224,    "file is read protected",
  97.     225,    "not a valid DOS disk",
  98.     226,    "no disk in drive",
  99.     232,    "no more entries in directory",
  100.     233,    "object is soft link",
  101.     234,    "object is linked",
  102.     235,    "bad loadfile hunk",
  103.     236,    "function not implemented",
  104.     240,    "record not locked",
  105.     241,    "record lock collision",
  106.     242,    "record lock timeout",
  107.     243,    "record unlock error",
  108.  
  109.  /* custom error messages */
  110.  
  111.     500,    "Bad arguments",
  112.     501,    "Label not found",
  113.     502,    "Must be within source file",
  114.     503,    "Syntax error",
  115.     504,    "Redirection error",
  116.     505,    "Pipe error",
  117.     506,    "Too many arguments",
  118.     507,    "Destination not a directory",
  119.     508,    "Cannot mv a filesystem",
  120.     509,    "Error in command name",
  121.     510,    "Bad drive name",
  122.     511,    "Illegal number",
  123.     512,    "Out of memory",
  124.     513,    "User interrupt",
  125.     0,    NULL
  126. };
  127.  
  128. char **av;                    /* Internal argument list                */
  129. FILE *Src_base[MAXSRC];        /* file pointers for source files        */
  130. long  Src_pos[MAXSRC];        /* seek position storage for same        */
  131. short Src_if[MAXSRC];        /* the if level at batch file start        */
  132. short Src_abort[MAXSRC];    /* abort this batch file                */
  133. char If_base[MAXIF];        /* If/Else stack for conditionals        */
  134. int H_len, H_tail_base;        /* History associated stuff                */
  135. int H_stack, H_num;            /* AddHistory disable stack                */
  136. int E_stack;                /* Exception disable stack                */
  137. int Src_stack, If_stack;    /* Stack Indexes                        */
  138. int forward_goto;            /* Flag for searching for foward lables    */
  139. int ac;                        /* Internal argc                        */
  140. int max_ac=256;                /* Maximum # of args (increasable)        */
  141. int debug;                    /* Debug mode                            */
  142. int disable;                /* Disable com. execution (conditionals)*/
  143. int Verbose;                /* Verbose mode for source files        */
  144. int Lastresult;                /* Last return code                        */
  145. int Exec_abortline;            /* flag to abort rest of line            */
  146. int Quit;                    /* Quit flag                            */
  147. char stdin_redir;            /* stdin is redirected                    */
  148. char stdout_redir;            /* stdout is redirected                    */
  149. char *MyMem;
  150. struct Process *Myprocess = NULL;    /* CSH's process */
  151. struct Window *Mywindow = NULL;        /* CSH's window, may be NULL! */
  152. struct CommandLineInterface *Mycli;
  153. struct DosPacket *Mypacket;
  154. int S_histlen = 20;            /* Max # history entries                */
  155.  
  156. unsigned int options;
  157. char Buf[280], confirmed, asked;
  158. CLASS *CRoot, *LastCRoot;
  159.  
  160. long IoError;
  161.  
  162. /* internal programm path hash-list */
  163. char **prghash_list = NULL;
  164. long prghash_num = 0L;
  165.  
  166.